// For format details, see https://aka.ms/devcontainer.json.
{
	"name": "WASM singlethreaded development (prebuilt)",
	"build": {
		"dockerfile": "Dockerfile",
		"args": {
			// Update 'VARIANT' to pick a .NET Core version: 6.0, 7.0
			"VARIANT": "6.0-jammy"
		}
	},
	"hostRequirements": {
		"cpus": 4,
		"memory": "8gb",
		"storage": "40gb"
	},

	"features": {
		"ghcr.io/devcontainers/features/github-cli:1": {}
	},

	// Configure tool-specific properties.
	"customizations": {
		// Configure properties specific to VS Code.
		"vscode": {
			// Add the IDs of extensions you want installed when the container is created.
			"extensions": [
				"ms-dotnettools.csharp"
			],
			"settings": {
				// Loading projects on demand is better for larger codebases
				"omnisharp.enableMsBuildLoadProjectsOnDemand": true,
				"omnisharp.enableRoslynAnalyzers": true,
				"omnisharp.enableEditorConfigSupport": true,
				"omnisharp.enableAsyncCompletion": true,
				"omnisharp.testRunSettings": "${containerWorkspaceFolder}/artifacts/obj/vscode/.runsettings"
			}
		}
	},

	// Use 'onCreateCommand' to run pre-build commands inside the codespace
	"onCreateCommand": "${containerWorkspaceFolder}/.devcontainer/scripts/onCreateCommand.sh wasm",

	// Use 'postCreateCommand' to run commands after the container is created.
	"postCreateCommand": "${containerWorkspaceFolder}/.devcontainer/scripts/postCreateCommand.sh wasm",

	// Add the locally installed dotnet to the path to ensure that it is activated
	// This allows developers to just use 'dotnet build' on the command-line, and the local dotnet version will be used.
	// Add the global tools dir to the PATH so that globally installed tools will work
	"remoteEnv": {
		"PATH": "${containerWorkspaceFolder}/.dotnet:${containerWorkspaceFolder}/.dotnet-tools-global:${containerEnv:PATH}",
		"DOTNET_MULTILEVEL_LOOKUP": "0",
		// Path to provisioned Emscripten SDK, for rebuilding the wasm runtime
		"EMSDK_PATH": "${containerWorkspaceFolder}/src/mono/browser/emsdk",
	},

	// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
	"remoteUser": "vscode",

	// Forward mono samples port
	"forwardPorts": [8000],
	"portsAttributes": {
		"8000": {
			"label": "mono wasm samples (8000)",
		}
	}
}
